package com.project.controller;


import com.mysql.fabric.xmlrpc.base.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Controller
@RequestMapping("user")
public class UserController {

    //形如/user/del/1，得到url，由当前方法处理
    //将url中的1赋值userId变量，然后将userId变量的值赋值给形参变量id
    @RequestMapping("del/{userId}")
    public void del(@PathVariable("userId") int id,
                    HttpServletResponse response) throws Exception{
        response.setContentType("text/html;charset=utf-8");
        response.getWriter().println("id="+id);
    }

    @RequestMapping("cutPage")
    public void cutPage(@RequestParam(value = "pageNo",defaultValue = "1") int pageNo, HttpServletResponse response) throws Exception{
        response.getWriter().println("pageNo= "+pageNo);
    }
}
